<include file="../Public/_top" />
<div class="content">
  <div class="wrap">
    <div class="con_side">
      <ul class="nav">
        <li><a href="{:U('public/Resources/index')}">培训资讯</a></li>
        <li class="cursor"><a href="{:U('public/Resources/TeacherResources')}">学习资源</a></li>
      </ul>
    </div>
    <div class="con_main">
    <volist name="data" id="d">
      <div class="con_tit">
        <a class="fr" href="{:U('public/Resources/more',array('id'=>$d['id']))}">更多</a>
        <span style="font-weight:bold;color:#000;font-family:'新宋体'">{$d.name}</span>
          <ul class="con_tit_ul">
            <volist name="d['level']" id="l" key="k" >
              <li>
                <a href="javascript:;" style="background:#dcdcdd;" onclick="selectChildren(this);">{$l.name}</a>
                <ul class="children">
                  <volist name="l['level']" id="sl" key="key" >
                    <li><a href="javascript:;" onclick="select_type(this,{$sl.id},{$l.id},{$k},{$d.id})">{$sl.name}</a></li>
                  </volist>
                </ul>
              </li>
            </volist>
              <li>
                <a href="javascript:;" style="background:#dcdcdd;" onclick="selectChildren(this);">资源类型</a>
                <ul class="children">
                  <li><a href="javascript:;"onclick="select_category(this,1)">文档资源</a></li>
                  <li><a href="javascript:;"onclick="select_category(this,2)">视频资源</a></li>
                </ul>
              </li>
              <li>
                <input type="hidden" id="number{$d.id}">
                <input type="hidden" id="resource_type{$d.id}">
                <div href="javascript:;" onclick="select_filter({$d.id});" style="background:#f68d04;margin-left:15px;width:70px;text-align:center; color:#efefef;line-height: 45px;cursor:pointer;">确定</div>
              </li>
          </ul>
      </div>
      <div class="con_box" id="resource_list{$d.id}">
        <ul class="learningList">
          <volist name="d['data']" id="listData">
            <li> 
              <div class="pic">
                <a href="{:U('public/Resources/view',array('id'=>$listData['id']))}">
                  <img src="{$listData.img_url}" />
                </a>
              </div>
              <div style="margin-top:15px;margin-left:10px;">
                <a href="{:U('public/Resources/view',array('id'=>$listData['id']))}" style="font-size:16px;" >《{$listData.resource_name}》
                </a>
              </div>
              <div class="txt" style="margin-top:15px;margin-left:10px;font-size:14px;">
                <span>{$listData['ctime']|date='Y/m/d',###}</span>
                <if condition="$listData['category'] eq 1">文档资源<else/>视频资源</if>
              </div>
              <div class="stu" style="margin-top:15px;">
                <span></span>{$listData.learn_sum}人已学
              </div>
            </li>
          </volist>
        </ul>
      </div>
    </volist>
    </div>
  </div>
</div>
<input type="hidden" id="category">
<input type="hidden" id="resource_teacher">
<input type="hidden" id="type1">
<input type="hidden" id="type2">
<script>
  function select_type(cate,id,fid,key,ffid){
    $(cate).parent().nextAll().children().css('background','');
    $(cate).parent().prevAll().children().css('background','');
    $(cate).css('background','#f3a33a');
    if(fid==31 || fid==46){
      $("#resource_teacher").val("");
      $("#resource_teacher").val(id);
    }else{
      $("#type"+key).val("");
      str=ffid+"/"+fid+"/"+id;
      $("#type"+key).val(str);
    }
  }
  function select_category(cate,id){
    $(cate).parent().nextAll().children().css('background','');
    $(cate).parent().prevAll().children().css('background','');
    $(cate).css('background','#f3a33a');
    $("#category").val(id);
  }
  function select_filter(id){
    $(".children").css('display','none');
    category=$("#category").val();
    resource_type="";
    resource_teacher=$("#resource_teacher").val();
    type1=$("#type1").val();
    type2=$("#type2").val();
    if(type1){
      resource_type=type1;
      if(type2){
        resource_type+=","+type2;
      }
    }else{
      if(type2){
        resource_type=type2;
      }
    }
    $.ajax({
        type: "POST",
        url:"{:U('public/Resources/getResourceList')}",
        data:"category="+category+"&resource_type="+resource_type+"&resource_teacher="+resource_teacher,
        dataType:"text",
        success:function(data){
          $("#resource_list"+id).html("");
          $("#resource_list"+id).append(data); 
        }
      });
  }
  function selectChildren(cate){
    $(".children").css('display','none');
    $(cate).next().css('display', 'block');
  }
</script>
<include file="../Public/_foot" />